{{:ModuleInclude('public/header')}}

<!-- right content start  -->
<div class="content-right">
    <div class="content">
        <!-- form start -->
        <form class="am-form form-validation am-form-popup-sticky" action="{{:MyUrl('admin/site/save')}}" method="POST" request-type="ajax-view" request-value="{{:MyUrl('admin/site/index', ['nav_type'=>'sitetype'])}}" enctype="multipart/form-data">
            {{:ModuleInclude('public/nav_switch_btn', [
                'nav_data' => [
                    [
                        'name' => MyLang('base_config_title'),
                        'key'  => 'base-config-title',
                    ],
                    [
                        'name' => MyLang('site.base_item_self_extraction_title'),
                        'key'  => 'site-self-extraction',
                    ],
                    [
                        'name' => MyLang('site.base_item_fictitious_title'),
                        'key'  => 'site-item-fictitious',
                    ]
                ]
            ])}}
            <div class="nav-content">
                <!-- 提示 -->
                {{if is_array(MyLang('site.sitetype_top_tips_list'))}}
                    <div class="am-operate-stretch-tips">
                        <div class="title">
                            <i class="iconfont icon-tips"></i>
                            <strong title="{{:MyLang('operate_list_tips_msg')}}">{{:MyLang('operate_list_tips_button_text')}}</strong>
                            <i class="iconfont icon-contract contract" title="{{:MyLang('operate_list_tips_retract_text')}}"></i> 
                        </div>
                        <p>{{:implode('</p><p>', MyLang('site.sitetype_top_tips_list'))}}</p>
                    </div>
                {{/if}}
                <!-- 基础配置 -->
                <div class="item am-active" data-key="base-config-title">
                    <!-- 展示型 -->
                    <div class="am-form-group">
                        <label class="am-block">{{$data.common_is_exhibition_mode_btn_text.name}}<span class="am-form-group-label-tips">{{$data.common_is_exhibition_mode_btn_text.describe}}</span></label>
                        <input type="text" name="{{$data.common_is_exhibition_mode_btn_text.only_tag}}" placeholder="{{$data.common_is_exhibition_mode_btn_text.describe}}" data-validation-message="{{$data.common_is_exhibition_mode_btn_text.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_is_exhibition_mode_btn_text.value}}"{{/if}} />
                    </div>

                    <!-- 站点类型 -->
                    <div class="platform-list-value-container">
                        <label class="am-block am-margin-bottom-sm">{{$data.common_site_type.name}}<span class="am-form-group-label-tips">{{$data.common_site_type.describe}}</span></label>
                        <div class="site-type-list">
                            {{foreach $common_platform_type as $k=>$v}}
                                <div class="am-flex am-flex-row am-flex-items-center am-gap-1 {{if $k gt 0}}am-margin-top-sm{{/if}}">
                                    <span class="am-text-right">{{$v.name}}</span>
                                    <select name="{{$data.common_site_type.only_tag}}[{{$v.value}}]" class="am-radius chosen-select" data-placeholder="{{:MyLang('optional_tips')}}" data-validation-message="{{:MyLang('site.site_setup_choice_payment_message', ['name'=>$v['name']])}}">
                                        {{if !empty($common_site_type_list)}}
                                            {{foreach $common_site_type_list as $site}}
                                                <option value="{{$site.value}}" {{if !empty($data['common_site_type']) and !empty($data['common_site_type']['value']) and isset($data['common_site_type']['value'][$v['value']]) and $data['common_site_type']['value'][$v['value']] eq $site['value']}}selected{{/if}}>{{$site.name}}</option>
                                            {{/foreach}}
                                        {{/if}}
                                    </select>
                                </div>
                            {{/foreach}}
                        </div>
                    </div>
                </div>

                <!-- 自提点 -->
                <div class="item" data-key="site-self-extraction">
                    <div class="am-form-group">
                        <div class="card-grey">
                            <div class="am-flex am-flex-col am-gap-1">
                                <label class="am-block">{{:MyLang('site.base_item_self_extraction_title')}}</label>
                                <ul class="address-list am-nbfc am-radius am-padding-0">
                                    {{if !empty($sitetype_address_list) and is_array($sitetype_address_list)}}
                                        {{foreach $sitetype_address_list as $address}}
                                            <li class="am-flex am-flex-justify-between am-flex-items-center am-gap-12">
                                                <div class="am-flex am-flex-items-center am-flex-1 am-flex-width">
                                                    {{if !empty($address['logo'])}}
                                                        <img src="{{$address.logo}}" alt="{{$address.name}}" class="am-img-thumbnail am-radius address-logo" />
                                                    {{/if}}
                                                    <span class="address-content">
                                                        <span class="address-text">{{$address.province_name}} {{$address.city_name}} {{$address.county_name}} {{$address.address}}（{{$address.name}}-{{$address.tel}}）</span>
                                                        {{if !empty($address['alias'])}}
                                                        <span class="am-badge am-radius-sm am-badge-success am-margin-left-xs">{{$address.alias}}</span>
                                                        {{/if}}
                                                    </span>
                                                </div>
                                                <div>
                                                    <span class="edit-submit"><i class="iconfont icon-edit am-text-xs"></i>{{:MyLang('edit_title')}}</span>
                                                    <span class="delete-submit"><i class="iconfont icon-btn-del am-text-xs"></i>{{:MyLang('remove_title')}}</span>
                                                </div>
                                            </li>
                                        {{/foreach}}
                                    {{/if}}
                                </ul>
                            </div>
                            <div class="am-flex">
                                <input type="hidden" name="{{$data.common_self_extraction_address.only_tag}}" value="{{$data.common_self_extraction_address.value}}" class="self-extraction-address-value" />
                                <button type="button" class="am-btn am-btn-primary-light-plain am-radius am-btn-xs address-submit-add"> 
                                    <i class="iconfont icon-btn-add am-text-xs"></i>
                                    {{:MyLang('site.add_self_extractio_address_title')}}
                                </button>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 虚拟销售 -->
                <div class="item" data-key="site-item-fictitious">
                    <div class="am-form-group">
                        <label class="am-block">{{$data.common_site_fictitious_return_title.name}}<span class="am-form-group-label-tips">{{$data.common_site_fictitious_return_title.describe}}</span></label>
                        <input type="text" name="{{$data.common_site_fictitious_return_title.only_tag}}" placeholder="{{$data.common_site_fictitious_return_title.describe}}" data-validation-message="{{$data.common_site_fictitious_return_title.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_site_fictitious_return_title.value}}"{{/if}} />
                    </div>
                    <div class="am-form-group">
                        <label class="am-block">{{$data.common_site_fictitious_return_tips.name}}<span class="am-form-group-label-tips">{{$data.common_site_fictitious_return_tips.describe}}</span></label>
                        <textarea rows="4" name="{{$data.common_site_fictitious_return_tips.only_tag}}" class="am-radius" placeholder="{{$data.common_site_fictitious_return_tips.name}}" data-validation-message="{{$data.common_site_fictitious_return_tips.error_tips}}">{{if !empty($data)}}{{$data.common_site_fictitious_return_tips.value}}{{/if}}</textarea>
                    </div>
                </div>
            </div>

            <div class="am-form-popup-submit">
                <input type="hidden" name="nav_type" value="{{$nav_type}}" />
                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                    <i class="am-icon-save"></i>
                    <span>{{:MyLang('save_title')}}</span>
                </button>
            </div>
        </form>
        <!-- form end -->


        <!-- 自提点地址添加弹层 -->
        <div class="am-popup am-radius" id="popup-address-win">
            <div class="am-popup-inner">
                <div class="am-popup-hd">
                    <h4 class="am-popup-title">{{:MyLang('site.form_take_address_title')}}</h4>
                    <span data-am-modal-close class="am-close">&times;</span>
                </div>
                <div class="am-popup-bd">
                    <form class="am-form form-validation-address am-form-full-screen am-form-popup-fixed" method="post" request-type="sync" request-value="ViewAddressModalBack">
                        <div class="am-form-group row am-form-file">
                            <label class="am-block">
                                {{:MyLang('site.form_take_address_logo')}}
                                <a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('site.form_take_address_logo_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a>
                            </label>
                            <div class="am-form-file-upload-container">
                                <ul class="plug-file-upload-view sitetype-logo" data-form-name="logo" data-max-number="1" data-dialog-type="images">
                                    <li class="plug-file-upload-submit" data-view-tag="ul.sitetype-logo">
                                        <i class="iconfont icon-upload-add"></i>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_alias')}}</label>
                            <input type="text" name="alias" placeholder="{{:MyLang('site.form_take_address_alias_message')}}" minlength="0" maxlength="16" data-validation-message="{{:MyLang('site.form_take_address_alias_message')}}" class="am-radius" />
                        </div>
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_name')}}<span class="am-form-group-label-tips-must">*</span></label>
                            <input type="text" name="name" placeholder="{{:MyLang('site.form_take_address_name_message')}}" minlength="1" maxlength="60" data-validation-message="{{:MyLang('site.form_take_address_name_message')}}" class="am-radius" required />
                        </div>
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_tel')}}<span class="am-form-group-label-tips-must">*</span></label>
                            <input type="text" name="tel" placeholder="{{:MyLang('site.form_take_address_tel')}}" minlength="6" maxlength="30" data-validation-message="{{:MyLang('site.form_take_address_tel_message')}}" class="am-radius" required />
                        </div>
        
                        {{:ModuleInclude('lib/region_linkage', ['is_row'=>1])}}
                        <div class="am-form-group row">
                            <label class="am-block">{{:MyLang('site.form_take_address_address')}}<span class="am-form-group-label-tips-must">*</span></label>
                            <div class="am-flex am-flex-items-center am-width am-pr">
                                <input type="hidden" name="lng" id="form-lng" />
                                <input type="hidden" name="lat" id="form-lat" />
                                <input type="text" name="address" id="form-address" data-is-clearout="0" placeholder="{{:MyLang('site.form_take_address_address')}}" minlength="2" maxlength="80" data-validation-message="{{:MyLang('site.form_take_address_address_message')}}" class="am-radius am-map-positioning-input" required />
                                <i class="iconfont icon-map-position am-map-positioning-icon" id="map-location-submit"></i>
                            </div>
                        </div>
                        <div id="map" data-level="17" class="am-radius-lg"></div>
                        <div class="am-form-popup-submit">
                            <button type="button" class="am-btn am-btn-warning am-radius am-btn-xs am-margin-right-lg" data-am-modal-close>
                                <i class="am-icon-paint-brush"></i>
                                <span>{{:MyLang('cancel_title')}}</span>
                            </button>
                            <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('confirm_title')}}'}">
                                <i class="am-icon-check"></i>
                                <span>{{:MyLang('confirm_title')}}</span>
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{:ModuleInclude('public/footer')}}

<script type="text/javascript">
// 返回处理
function ViewAddressModalBack(data)
{
    AddressModalHandle(data);
}
</script>